﻿
@using Kooboo.CMS.Content.Models;
@using Kooboo.CMS.Content.Query;
@{ var schema = (Kooboo.CMS.Content.Models.Schema)ViewData["Schema"];
    var allowedEdit = (bool)ViewData["AllowedEdit"];
    var allowedView = (bool)ViewData["AllowedView"];}
@using(Html.BeginForm(ViewContext.RequestContext.AllRouteValues()["action"].ToString()
    , ViewContext.RequestContext.AllRouteValues()["controller"].ToString()
    , ViewContext.RequestContext.AllRouteValues()
    , FormMethod.Post
    , new RouteValueDictionary(new { enctype = "application/x-www-form-urlencoded" })))
{
    <div class="common-form">
    <fieldset>
    <table><tr>
            <td>
            <label for="Name">Adı</label>
            </td>
            <td>
            <input id="Name" name="Name" type="text" value="@(Model.Name ?? "")"  data-val-required="The Name field is required." data-val="true"/>
            @Html.ValidationMessageForColumn(((ISchema)ViewData["Schema"])["Name"], null)
            </td>          
            </tr><tr>
            <td>
            <label for="EMail">E-Posta Adresi</label>
            </td>
            <td>
            <input id="EMail" name="EMail" type="text" value="@(Model.EMail ?? "")"  data-val-regex="E-Posta Adresi D&amp;#252;zg&amp;#252;n Formatta Girilmelidir" data-val-regex-pattern="\w+([-+.&#39;]\w+)*@@\w+([-.]\w+)*\.\w+([-.]\w+)*" data-val="true"/>
            @Html.ValidationMessageForColumn(((ISchema)ViewData["Schema"])["EMail"], null)
            </td>          
            </tr><tr>
            <td>
            <label for="Address">Adres</label>
            </td>
            <td>
            <input id="Address" name="Address" type="text" value="@(Model.Address ?? "")"  data-val-required="" data-val="true"/>
            @Html.ValidationMessageForColumn(((ISchema)ViewData["Schema"])["Address"], null)
            </td>          
            </tr><tr>
            <td>
            <label for="PhoneNo">Telefon No</label>
            </td>
            <td>
            <input id="PhoneNo" name="PhoneNo" type="text" value="@(Model.PhoneNo ?? "")"  data-val-required="" data-val="true"/>
            @Html.ValidationMessageForColumn(((ISchema)ViewData["Schema"])["PhoneNo"], null)
            </td>          
            </tr><tr>
            <td>
            <label for="Message">Mesaj</label>
            </td>
            <td>
            <textarea name="Message" rows="10" cols="100"  data-val-required="" data-val="true">@(Model.Message ?? "")</textarea> 
            @Html.ValidationMessageForColumn(((ISchema)ViewData["Schema"])["Message"], null)
            </td>          
            </tr>
            @if (allowedEdit) {
                <tr>
            <td>
            <label for="Published">Published</label>
            </td>
            <td>
            <input name="Published" type="checkbox" @(Convert.ToBoolean(Model.Published)?"checked":"") value="true"/>
                                    <input type="hidden" value="false" name="Published"/>
            @Html.ValidationMessageForColumn(((ISchema)ViewData["Schema"])["Published"], null)
            </td>          
            </tr>
            }
    @Html.Action("Categories", ViewContext.RequestContext.AllRouteValues())
    </table>
    </fieldset>
    <p class="buttons"><button type="submit">@("Save".Localize())</button> <a href="javascript:;" class="dialog-close button">@("Close".Localize())</a> </p>
    </div>
}